package com.sc.nft.admin.controller;


import com.sc.nft.annotation.SysMemberLogin;
import com.sc.nft.entity.dto.MallDaoProfitTemplateAdminPageDTO;
import com.sc.nft.entity.vo.EditMallDaoProfitTemplateVO;
import com.sc.nft.entity.vo.MallDaoProfitTemplateAdminPageVO;
import com.sc.nft.service.MallDaoProfitTemplateService;
import com.sc.nft.sup.PageResult;
import com.sc.nft.sup.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * <p>
 * 商城分润模版DAO白名单 前端控制器
 * </p>
 *
 * @author ligen
 * @since 2024-01-09
 */
@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("/admin/dao/profitTemplate")
@Api(tags = "商城分润模版模块")
public class MallDaoProfitTemplateController {

    public final MallDaoProfitTemplateService mallDaoProfitTemplateService;


    @ApiOperation(value = "商城分润模版白名单列表", notes = "商城分润模版白名单列表", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/page", produces = MediaType.APPLICATION_JSON_VALUE)
    @SysMemberLogin
    public PageResult<MallDaoProfitTemplateAdminPageDTO> mallProfitTemplateAdminPage(@RequestBody MallDaoProfitTemplateAdminPageVO vo) {
        return PageResult.success(mallDaoProfitTemplateService.getAdminPage(vo));
    }

    @ApiOperation(value = "编辑商城分润模版白名单", notes = "编辑商城分润模版白名单", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/edit", produces = MediaType.APPLICATION_JSON_VALUE)
    @SysMemberLogin
    public Result edit(@Valid @RequestBody EditMallDaoProfitTemplateVO editMallDaoProfitTemplateVO) {
        mallDaoProfitTemplateService.edit(editMallDaoProfitTemplateVO);
        return Result.success();
    }

}
